package com.example.userlogin;

import java.util.ArrayList;
import java.util.HashMap;

import com.example.userlogin.R;
import com.example.userlogin.UsrActivity;

import android.app.ListActivity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.EditText;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import android.widget.AdapterView.OnItemClickListener;

public class Register extends ListActivity {
	
	Intent intent;
	TextView userName;
	TextView password;
	TextView email;
	DBController controller = new DBController(this);
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_usr);
		
		ArrayList<HashMap<String, String>> tableList =  controller.get();
		
		/*
		if(tableList.size()!=0) {
			ListView lv = getListView();
		}
			
			lv.setOnItemClickListener(new OnItemClickListener() {
				  @Override 
				  public void onItemClick(AdapterView<?> parent, View view,int position, long id) {
					  userName = (TextView) view.findViewById(R.id.userName);
					  String valuserName = userName.getText().toString();	
					  password = (TextView) view.findViewById(R.id.password);
					  String valupassword = password.getText().toString();
					  Intent  objIndent = new Intent(Register.this,EditAnimal.class);
					  objIndent.putExtra("animalId", valAnimalId); 
					  startActivity(objIndent); 
				  }
			});
		}
		*/
		ListAdapter adapter = new SimpleAdapter( Register.this, tableList, R.layout.activity_usr, new String[] { "userName","password", "email"}, new int[] {R.id.userName, R.id.password, R.id.email}); 
		setListAdapter(adapter);
		
	}

}
